package com.example.springcloudseata.controller;

import com.example.springcloudseata.fegin.UserServiceFegin;
import com.example.springcloudseata.service.UserService;
import com.xuewei.springcloudcommon.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhangxuewei
 * @since 2023-04-10
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Resource
    UserServiceFegin userServiceFegin;
    @Resource
    UserService userService;

    @GetMapping(value = "/get1")
    public String get1(){
        return "ok";
    }

    @GetMapping(value = "/get")
    public Map<String,Object> getById(){
        Map<String,Object> resultMap = new HashMap();
        Result byId = userServiceFegin.getUserById(1);
        resultMap.put("user",byId);
        return resultMap;
    }


    @GetMapping(value = "/add")
    public String add(){
        userService.add();
        return "OK";
    }


}

